<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCustomerTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('customer', function (Blueprint $table) {
            $table->increments('id');
            $table->string('tel')->unique()->nullable();
            $table->string('password')->nullable();
            $table->string('openid', 64)->unique()->comment('openid');
            $table->rememberToken();
            $table->timestamps();
        });

        Schema::create('customer_info', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('customer_id')->nullable()->comment('用户id');
            $table->tinyInteger('sex')->comment('sex');
            $table->string('province', 64)->comment('province');
            $table->string('city', 64)->comment('city');
            $table->string('country', 64)->comment('country');
            $table->string('headimgurl')->comment('headimgurl');
            $table->text('privilege')->comment('privilege');
            $table->string('unionid', 64)->nullable()->comment('unionid');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('customer');
        Schema::dropIfExists('customer_info');
    }
}
